/*!
\copyright  Copyright (c) 2019-2025 Qualcomm Technologies International, Ltd.
            All Rights Reserved.
            Qualcomm Technologies International, Ltd. Confidential and Proprietary.
\file
\defgroup   microphones Microphones
\ingroup    audio_domain
\brief      Microphone configuration for RDP MOTION hardware
*/

#ifndef MIC_CONFIG_RDP_HW_MOTION_H
#define MIC_CONFIG_RDP_HW_MOTION_H

#ifdef HAVE_RDP_HW_MOTION

#include <kymera_chain_roles.h>
#include "microphones_config.h"

#define MICROPHONES_CONFIG_PLATFORM

static const microphones_bias_config_t platform_mic_bias_config[] = {
    { .id=BIAS_CONFIG_MIC_BIAS_0, .voltage=3 },
    { .id=BIAS_CONFIG_MIC_BIAS_1, .voltage=3 }
};

static const unsigned platform_num_bias = ARRAY_DIM(platform_mic_bias_config);

static const int mic0_roles[] = {
    MIR_INTERNAL_BCM,
#ifdef INCLUDE_LIS25BA_ACCELEROMETER
    MIR_INTERNAL_PCM,
#endif
    MIR_SELF_SPEECH_DETECT,
};

static const int mic1_roles[] = {
    MIR_INTERNAL,
    MIR_ANC_FEED_BACK,

    EPR_CVC_SEND_IN3,
    EPR_RATE_ADJUST_IN3,
};

static const int mic2_roles[] = {
    MIR_EXTERNAL,
    EPR_VA_MIC_MIC2_IN,
    MIR_ANC_FEED_FORWARD,
    MIR_ANC_WIND_DETECT_FF,

    EPR_CVC_SEND_IN2,
    EPR_RATE_ADJUST_IN2,
    EPR_AANC_FBC_FF_MIC_IN,
};

static const int mic3_roles[] = {
    MIR_VOICE,
    EPR_VA_MIC_MIC1_IN,
    MIR_LEAKTHROUGH,
    MIR_ANC_WIND_DETECT_DIVERSITY,

    EPR_CVC_SEND_IN1,
    EPR_RATE_ADJUST_IN1,
    EPR_MIC_MIC1_IN,
};

static const microphones_mic_config_t platform_microphone_configs[] = {
    {
        .params = {
            .bias_config = BIAS_CONFIG_MIC_BIAS_0,
#ifdef INCLUDE_LIS25BA_ACCELEROMETER
            .pio = 22,
            .type = mic_type_pcm,
            .instance = AUDIO_INSTANCE_1,
            .channel = AUDIO_CHANNEL_SLOT_2,
#endif
            .pio = 19,
            .type = mic_type_analog,
            .instance = AUDIO_INSTANCE_0,
            .channel = AUDIO_CHANNEL_A,
        },
        .roles = mic0_roles,
        .num_roles = ARRAY_DIM(mic0_roles),
    },
    {
        .params = {
            .bias_config = BIAS_CONFIG_MIC_BIAS_0,
            .pio = 22,
            .type = mic_type_analog,
            .instance = AUDIO_INSTANCE_0,
            .channel = AUDIO_CHANNEL_B,
        },
        .roles = mic1_roles,
        .num_roles = ARRAY_DIM(mic1_roles),
    },
    {
        .params = {
            .bias_config = BIAS_CONFIG_PIO,
            .pio = 39,
            .type = mic_type_digital,
            .instance = AUDIO_INSTANCE_1,
            .channel = AUDIO_CHANNEL_A,
        },
        .roles = mic2_roles,
        .num_roles = ARRAY_DIM(mic2_roles),
    },
    {
        .params = {
            .bias_config = BIAS_CONFIG_PIO,
            .pio = 38,
            .gain = 15,
            .type = mic_type_digital,
            .instance = AUDIO_INSTANCE_1,
            .channel = AUDIO_CHANNEL_B,
        },
        .roles = mic3_roles,
        .num_roles = ARRAY_DIM(mic3_roles),
    },
};

static const unsigned platform_num_mics = ARRAY_DIM(platform_microphone_configs);

#endif /* HAVE_RDP_HW_MOTION */
#endif /*MIC_CONFIG_RDP_HW_MOTION_H*/
